package com.hgkj.common.core.utils;

import java.util.Random;

/**
 * 随机盐生成工具类
 */
public class RandomSaltUtils {
    private static final int range = 100000;

    public static String getSalt(boolean irregularTime){
        if(!irregularTime){
            return getSalt();
        }
        long slat = DateUtils.getNowTime();
        int random = new Random().nextInt(range) + 1;
        slat += (random % 2 == 0) ? random : -random;
        return Long.toString(slat);
    }

    public static String getSalt(){
        return DateUtils.getNowTime().toString();
    }
}
